package 基础.功能;

/**
 * 学习一个runnable
 *
 * runnable
 * thread
 *
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/6/30 下午8:35
 */
public class RunnableDemo implements Runnable{

    @Override
    public void run() {
        //用户线程的
        System.out.println("==>");
    }

    public static void main(String[] args) {
        Runnable runnableDemo = new RunnableDemo();
        //我们要通过Thread 来完成对runable接口的代码

        Thread t1 = new Thread(runnableDemo);
        t1.start();

        //我们来通过内部类转换
        Thread t2 = new Thread(){
            @Override
            public void run() {
                System.out.println("我是内部类");
            }
        };

        //lambda
        Thread t3 = new Thread(()->{
            System.out.println("我是通过lambda方式生成的线程");
        });



        //还有一种jdk比较建议的方式线程池  一会来说


    }
}
